/**
 * Created by ${PRODUCT_NAME}.
 * User: skylerparr
 * Date: 12/19/10
 * Time: 6:37 PM
 * To change this template use File | Settings | File Templates.
 */
package com.thoughtorigin.service {
import com.thoughtorigin.deeplink.DeepLinker;
import com.thoughtorigin.relay.MessageRelay;

import com.thoughtorigin.relay.ResponseEvent;

import flash.events.Event;
import flash.events.EventDispatcher;

public class AbstractService extends EventDispatcher implements Service {

    private var _messageRelay: MessageRelay;
    private var _deeplinker: DeepLinker;

    public function AbstractService() {
    }

    public function handoff(message:Message):void {
    }

    public function get serviceName():String {
        return null;
    }

    override public function dispatchEvent(event:Event):Boolean {
        var evt: ResponseEvent = new ResponseEvent(ResponseEvent.RESPONSE, event);
        return super.dispatchEvent(evt);
    }

    [Inject]
    public function set messageRelay(value: MessageRelay): void {
        _messageRelay = value;
    }

    public function get messageRelay(): MessageRelay {
        return _messageRelay;
    }

    [Inject]
    public function set deeplinker(value: DeepLinker): void {
        _deeplinker = value;
    }

    public function get deeplinker(): DeepLinker {
        return _deeplinker;
    }

    public function get deeplinkMessage(): Message {
        return _deeplinker.buildMessage(_deeplinker.deepLinkString);
    }

    public function get createNew():Boolean {
        return false;
    }
}
}
